package com.nb.hdj.testCase.consultModule;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

/**
 * @Description: 查询咨询用例
 * @Author: hedongjia
 * @Date: 2021/11/19 &#x4E0B;&#x5348;2:35
 * @Version: v1.0
 */
public class SelectConsultCase extends ConsultCaseBase{

    /**
     * 咨询模糊查询
     * @param driver
     * @param content 输入内容
     * @return
     */
    public boolean selectConsult(WebDriver driver,String content){
        boolean selectFlag=false;
        try {
            //悬浮查询下拉标签
            seleniumUtil.hover(consultMap.get("SelectDownElement"),driver);
            //定位到输入查询
            seleniumUtil.elementClick(driver,By.xpath(consultMap.get("SelectInputElement")));
            //输入内容
            seleniumUtil.elementClickAndClearAndInput(driver,By.xpath(consultMap.get("SelectInputContentElement")),content);
            //点击确定
            seleniumUtil.elementClick(driver,By.xpath(consultMap.get("SelectSaveElement")));
            Thread.sleep(1000);
            //判断查询是否包含搜索关键字
            if(seleniumUtil.elementTextIsContains(driver,By.xpath(consultMap.get("insertConsultSuccessTitleElement")),content)){
                //清楚全部
                seleniumUtil.elementClick(driver,By.xpath(consultMap.get("SelectClearElement")));
                selectFlag=true;
            }

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return selectFlag;
    }
}
